package everyday;

import cn.hutool.core.builder.EqualsBuilder;
import org.junit.jupiter.api.Test;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalTime;

/**
 * CommonLang3 jar方法学习
 *
 * @author gaojie
 * @date 2023-07-28
 */
public class TestCommonLang3 {

    /**
     * 测试 EqualsBuilder 工具方法
     */
    @Test
    void test01() {
        final BigDecimal b1 = new BigDecimal("0.010000");
        final BigDecimal b2 = new BigDecimal("0.0100000");
        System.out.println(b1.setScale(10, RoundingMode.HALF_UP));
        System.out.println(b2.setScale(10, RoundingMode.HALF_UP));

        EqualsBuilder builder = new EqualsBuilder();
        builder.append("CS00", "CS00");
        builder.append(LocalTime.parse("23:45"), LocalTime.parse("23:45"));
//        builder.append(b1, b2); // BigDecimal 如果不统一精度就会判定为不一致
        builder.append(b1.setScale(5, RoundingMode.HALF_UP), b2.setScale(5, RoundingMode.HALF_UP));
        System.out.println(builder.isEquals());
    }
}
